var gulp = require('gulp');
var babel = require('gulp-babel');
var gUtil = require('gulp-util');
var uglify = require('gulp-uglify');
var webpack = require('webpack');
var webpackConfig = require('./webpackConfig');
gulp.task('webpack', function (cb) {
    webpack(webpackConfig, function (err, state) {
        if (err) gUtil.err(err);
        gUtil.log('[webpack]', state.toString());
        cb();
    })
});
gulp.task('babel', function (cb) {
    return gulp.src('public/javascripts/index/*.jsx').pipe(babel({"presets": ["react"]})).pipe(gulp.dest('public/javascripts/index/build'));
});
gulp.task('uglify', function () {
    return gulp.src('./public/javascripts/index.js').pipe(uglify()).pipe(gulp.dest('./public/javascripts/'))
});
gulp.task('default', ['babel', 'webpack', 'uglify']);